GLOBAL['id_check_box_select_all']=false;
function id_check_box_select_all(){
    var alltr=$('listdiv').$$('tr');
    for(var i=0;i<alltr.length;i++){
        var $$$=$$($$(alltr[i],'td')[0],'input')[0];
        if($$$!=undefined){
            $$$.checked=GLOBAL['id_check_box_select_all']?false:true;
        }
    }
    GLOBAL['id_check_box_select_all']=GLOBAL['id_check_box_select_all']?false:true;
}
function id_check_box_swop(){
    var alltr=$('listdiv').$$('tr');
    for(var i=0;i<alltr.length;i++){
        var $$$=$$($$(alltr[i],'td')[0],'input')[0];
        if($$$!=undefined){
            $$$.checked=$$$.checked?false:true;
        }
    }
}
function id_check_box_del(){
    if(_check_select_box()){
        $('brk_form').action=getlocation()+'/collac-manydel';
        $('brk_form').submit();
    }
}
function id_check_box_torecycle(){
    if(_check_select_box()){
        $('brk_form').action=getlocation()+'/collac-manytorecycle';
        $('brk_form').submit();
    }
}
function id_check_box_tolist(){
    if(_check_select_box()){
        $('brk_form').action=getlocation()+'/collac-manytolist';
        $('brk_form').submit();
    }
}


function id_check_box_top(){
    if(_check_select_box()){
        $('brk_form').action=getlocation()+'/collac-com/com-id/fire-top';
        $('brk_form').submit();
    }
}


function id_check_box_sort(){
    $('brk_form').action=getlocation()+'/collac-com/com-id/fire-sort';
    $('brk_form').submit();
}



function _check_select_box(){
    var alltr=$('listdiv').$$('tr');
    var ids=new Array();
    for(var i=0;i<alltr.length;i++){
        var $$$=$$($$(alltr[i],'td')[0],'input')[0];
        if($$$!=undefined){
            if($$$.checked==true){
                ids.push($$$.value)
            }
        }
    }
    if(ids.length==0){
        alert("没有选中项..");
        return false;
    }
    return true;
}

//显示组件选项DIV
GLOBAL['show_Component_Canvas_HTMLS']=new Array();
function show_Component_Canvas_box(id){
    if($(id).innerHTML!=''){
        GLOBAL['show_Component_Canvas_HTMLS'][id]=$(id).innerHTML;
        $(id).innerHTML='';
    }
    $('Component_Canvas_box').style.display="block";
    _set_Component_Canvas_box_innerHTML(GLOBAL['show_Component_Canvas_HTMLS'][id]);
}
//显示组件选项DIV
function _set_Component_Canvas_box_innerHTML($a){
    $('Component_Canvas').innerHTML=$a;
}
//是谁的div被显示了
GLOBAL['show_Component_Canvas_target']=new Array();
function show_Component_Canvas_target(obj){
    obj.style.borderWidth="0px 1px 3px 1px";
    for(var i=0; i<GLOBAL['show_Component_Canvas_target'].length;i++){
        GLOBAL['show_Component_Canvas_target'][i].style.borderBottomWidth="0px 1px 1px 1px";
    }
    GLOBAL['show_Component_Canvas_target'].push(obj);
}
function id_check_box_changecategory(){
    if(_check_select_box()){
        var ev=window.event || arguments.callee.caller.arguments[0];
        var target= ev.target||ev.srcElement;
        show_Component_Canvas_target(target);
        show_Component_Canvas_box('Component_Canvas_lib_category');
    }
}

function id_check_box_changecategory_submit(){
    if(_check_select_box()){
        if($('Component_options_category_select').value==0){
            alert('请选择分类啊..你不选是提交不了的');
            return;
        }else{
            $('brk_form').action=window.location+'/collac-com/com-category/fire-move/targetid-'+$('Component_options_category_select').value;
            $('brk_form').submit();
        }
    }
}
ATTACHMENT_fun_Plugins.push(function(img){
    if(img.attach_type=='.jpg' || img.attach_type=='.png'){
        return "<a href='#' onclick=\"attachment_title_img("+img.attach_id+",'"+img.attach_thumb+"');return false\">标题图片</a>";
    }else{
        return false;
    }
}
)
attachment_title_img=function(attach_id,attach_thumb){
    $('titleimg_element').value=attach_id;
    $('titleimgdiv').innerHTML="<img src='"+attach_thumb+"'/>"
}
